<?php
/**
 * @package Autogenerator for Joomla!
 * @version 3.0.0
 * @author Truong Cong Duc <truongcongduc4@gmail.com>
 * @link autogenerator.blogspot.com
 * @copyright (c) 2013, Truong Cong Duc
 * @license GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

class AutogeneratorControllerXml_attributes extends JControllerAdmin
{
    /**
     *
     * @var AutogeneratorModelXml_attribute 
     */
	public $oModelXml_attribute;

	public function __construct($arConfig = array())
	{
		parent::__construct($arConfig);
		
		$this->oModelXml_attribute = $this->getModel();
	}

	public function getModel($strName = 'Xml_attribute', $strPrefix = 'AutogeneratorModel', $arConfig = array('ignore_request' => true))
	{
		return parent::getModel($strName, $strPrefix, $arConfig);
	}
    
    public function saveOrderAjax()
	{
		$pks = $this->input->post->get('cid', array(), 'array');
		$order = $this->input->post->get('order', array(), 'array');

		// Sanitize the input
		JArrayHelper::toInteger($pks);
		JArrayHelper::toInteger($order);

		// Save the ordering
		$return = $this->oModelXml_attribute->saveorder($pks, $order);

		if ($return)
		{
			echo "1";
		}

		// Close the application
		JFactory::getApplication()->close();
	}
}
